# 导包
import app


# 创建接口类
class LoginRegAPI:
    # 初始化
    def __init__(self):
        # 设置接口URL信息
        self.url_image = app.BASE_URL + "/common/public/verifycode1/0.123456"
        self.url_phone = app.BASE_URL + "/member/public/sendSms"
        self.url_reg = app.BASE_URL + "/member/public/reg"
        self.url_login = app.BASE_URL + "/member/public/login"

    # 获取图片验证码
    def get_image_code(self, session):
        return session.get(self.url_image)

    # 获取短信验证码
    def get_phone_code(self, session, phone_data):
        return session.post(self.url_phone, data=phone_data)

    # 注册
    def reg(self, session, reg_data):
        return session.post(self.url_reg, data=reg_data)

    # 登录
    def login(self, session, login_data):
        return session.post(self.url_login, data=login_data)

